package com.zhc.dejingapi.service.impl;

import com.zhc.dejingapi.entity.QingInjectionworkshopshiftsEntity;
import com.zhc.dejingapi.entity.QingInjectionworkshopshiftsdetailEntity;
import com.zhc.dejingapi.entity.vo.QingInjectionworkshopshiftsVo;
import com.zhc.dejingapi.mapper.QingInjectionworkshopshiftsMapper;
import com.zhc.dejingapi.mapper.QingInjectionworkshopshiftsdetailMapper;
import com.zhc.dejingapi.service.QingInjectionworkshopshiftsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhc
 * @since 2024-10-28
 */
@Service

public class QingInjectionworkshopshiftsServiceImpl extends ServiceImpl<QingInjectionworkshopshiftsMapper, QingInjectionworkshopshiftsEntity> implements QingInjectionworkshopshiftsService {
    @Resource
    private QingInjectionworkshopshiftsMapper qingInjectionworkshopshiftsMapper;
    @Resource
    private QingInjectionworkshopshiftsdetailMapper qingInjectionworkshopshiftsdetailMapper;

    @Override
    public QingInjectionworkshopshiftsVo addQingInjectionworkshopshifts(QingInjectionworkshopshiftsVo qingInjectionworkshopshiftsVo) {
        QingInjectionworkshopshiftsEntity qingInjectionworkshopshiftsEntity = new QingInjectionworkshopshiftsEntity();

        qingInjectionworkshopshiftsEntity.setClasses(qingInjectionworkshopshiftsVo.getClasses());
        qingInjectionworkshopshiftsEntity.setShiftsrecords(qingInjectionworkshopshiftsVo.getShiftsrecords());
        qingInjectionworkshopshiftsEntity.setWritetime(qingInjectionworkshopshiftsVo.getWritetime());
        qingInjectionworkshopshiftsEntity.setSuccessionrecords(qingInjectionworkshopshiftsVo.getSuccessionrecords());
        qingInjectionworkshopshiftsMapper.insert(qingInjectionworkshopshiftsEntity);
        Long mainId = qingInjectionworkshopshiftsEntity.getMainId();
        List<QingInjectionworkshopshiftsdetailEntity> qingInjectionworkshopshiftsdetailEntityList = qingInjectionworkshopshiftsVo.getQingInjectionworkshopshiftsdetailEntityList();
        for (QingInjectionworkshopshiftsdetailEntity detailEntity : qingInjectionworkshopshiftsdetailEntityList) {
            QingInjectionworkshopshiftsdetailEntity qingInjectionworkshopshiftsdetailEntity = new QingInjectionworkshopshiftsdetailEntity();
            qingInjectionworkshopshiftsdetailEntity.setEmployeesonduty(detailEntity.getEmployeesonduty());
            qingInjectionworkshopshiftsdetailEntity.setEqCode(detailEntity.getEqCode());
            qingInjectionworkshopshiftsdetailEntity.setEqStatus(detailEntity.getEqStatus());
            qingInjectionworkshopshiftsdetailEntity.setMouldStatus(detailEntity.getMouldStatus());
            qingInjectionworkshopshiftsdetailEntity.setQualityStatus(detailEntity.getQualityStatus());
            qingInjectionworkshopshiftsdetailEntity.setPrecautions(detailEntity.getPrecautions());
            qingInjectionworkshopshiftsdetailEntity.setWorkshiftsId(mainId);
            qingInjectionworkshopshiftsdetailEntity.setSuccessoremployees(detailEntity.getSuccessoremployees());
            qingInjectionworkshopshiftsdetailMapper.insert(qingInjectionworkshopshiftsdetailEntity);
        }
        return null;
    }

    @Override
    public QingInjectionworkshopshiftsEntity getInfoById(Long mainId) {
        return null;
    }
}
